<?php
    session_start();
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <link href="css/base.css" rel="stylesheet" type="text/css">
</head>
<body>
    <div class="header">
        <span><a href="#" onclick="javascript:top.location.href='http://localhost:8080/cuisine/h5/index.php'">dark cuisine</a></span>
        &nbsp;&nbsp;&nbsp;&nbsp;
        <a href="#" onclick="javascript:top.location.href='http://localhost:8080/cuisine/h5/upload.html'">add new cuisine</a>
        <div id="userInfo">
            <span id="userName"></span>
            <a href='#' onclick="javascript:top.location.href='http://localhost:8080/cuisine/h5/loginPage.php'" id="loginBtn">login</a>
        </div>
        </div>
    </div>
    <script src="js/jquery.js" type="application/javascript"></script>
    <script type="application/javascript">
        $(function () {
            let userName = localStorage.getItem("userName");
            console.log(userName);
            if (userName) {
                $("#userName").show();
                $("#userName").html(userName);
                $("#loginBtn").hide();
            } else {
                $("#loginBtn").show();
                // $("#userName").html(userName);
                $("#userName").hide();
            }
        });
    </script>
</body>
</html>